/**
 * useContext(减少组件层级)
 */
 import React, { useState, useRef, useContext } from 'react';
 const GlobalContext=React.createContext()//创建Context对象
function FilmItem(){
    const value=useContext(GlobalContext)
    console.log(value)//可以拿到传过来的value
        return(
            
                <div>
                    <span>{value.name}CSDN碰磕</span>
                </div>
             )
}
 
 export default function MyContext() {
    return (
        //供应商
        <GlobalContext.Provider value={{
            name:"碰磕",
            age:18
        }}>
        <div>
            Context方案
            <FilmItem></FilmItem>
        </div>
        </GlobalContext.Provider>
    );
 }